package mySort;
//希尔排序
public class ShellSort {
    public void shellSort(int[] array) {
        int grap = array.length / 2;
        while (grap > 0) {
            //单趟插入排序
            for (int i = grap; i < array.length; i++) {
                int tmp = array[i];
                int j = i - grap;
                for (; j >= 0; j -= grap) {
                    if (array[j] > tmp) {
                        array[j + grap] = array[j];
                    } else {
                        break;
                    }
                }
                array[j + grap] = tmp;
            }

            grap /= 2;
        }
    }
}
